42 #include "event_groups.h" 45 #include "fxls8471q.h" 47 #include "fxas21002.h" 54 #include "fsl_debug_console.h" 57 #include "clock_config.h" 79 #define I2C_DRIVER Driver_I2C1_KSDK2_Blocking 86 static void read_task(
void *pvParameters);
95 BOARD_InitDebugConsole();
98 CLOCK_EnableClock(I2C_PORT_CLKEN);
99 PORT_SetPinMux(I2C_PORT, I2C_SDA_PIN, I2C_MUX);
100 PORT_SetPinMux(I2C_PORT, I2C_SCL_PIN, I2C_MUX);
101 CLOCK_EnableClock(I2C_CLKEN);
102 I2C_DRIVER.Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
113 xTaskCreate(
read_task,
"READ_TASK", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);
116 vTaskStartScheduler();
123 portTickType lastWakeTime;
124 const portTickType frequency = 10;
125 lastWakeTime = xTaskGetTickCount();
128 vTaskDelayUntil(&lastWakeTime, frequency);
129 GPIO_TogglePinsOutput(GPIOB, 1U << 9U);
void initSensorFusionGlobals(SensorFusionGlobals *sfg, StatusSubsystem *pStatusSubsystem, ControlSubsystem *pControlSubsystem)
utility function to insert default values in the top level structure
ControlSubsystem controlSubsystem
used for serial communications
int32_t loopcounter
counter incrementing each iteration of sensor fusion (typically 25Hz)
static void read_task(void *pvParameters)
int main(void)
This is a FreeRTOS (single task) implementation of the NXP sensor fusion demo build.
int8_t FXOS8700_Read(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
void initializeStatusSubsystem(StatusSubsystem *pStatus)
initializeStatusSubsystem() should be called once at startup to initialize the data structure and to ...
The top level fusion structure.
streamData_t * stream
function to create packets for serial stream
installSensor_t * installSensor
function for installing a new sensor into t
StatusSubsystem() provides an object-like interface for communicating status to the user...
readSensors_t * readSensors
read all physical sensors
struct ControlSubsystem * pControlSubsystem
initializeFusionEngine_t * initializeFusionEngine
set sensor fusion structures to initial values
updateStatus_t * updateStatus
status=next status
int8_t FXOS8700_Init(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
SensorFusionGlobals sfg
This is the primary sensor fusion data structure.
int8_t FXAS21002_Read(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
void myI2C_callback(uint32_t event)
Dummy callback function for the I2C driver.
The sensor_fusion.h file implements the top level programming interface.
Provides function prototypes for driver level interfaces.
he ControlSubsystem encapsulates command and data streaming functions.
int8_t initializeControlPort(ControlSubsystem *pComm)
Initialize the control subsystem and all related hardware.
runFusion_t * runFusion
run the fusion routines
Provides a simple abstraction for a periodic interval timer.
ARM_DRIVER_I2C * I2Cdrv
KSDK handle for the I2C port defined in Driver_I2C_KSDK2.c.
Application-specific status subsystem.
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
EventGroupHandle_t event_group
PhysicalSensor sensors[2]
This implementation uses two physical sensors.
setStatus_t * queueStatus
queue status change for next regular interval
Defines control sub-system.
ARM_DRIVER_I2C Driver_I2C1_KSDK2_Blocking
KSDK handle for the I2C port defined in Driver_I2C_KSDK2.
setStatus_t * setStatus
change status indicator immediately
uint8_t sUARTOutputBuffer[256]
main output buffer defined in control.c
applyPerturbation_t * applyPerturbation
apply step function for testing purposes
int8_t FXAS21002_Init(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
StatusSubsystem statusSubsystem
provides visual (usually LED) status indicator